package cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.service;

import cn.maihe.elg.operation.supports.electronicseal.kt.KtConfig;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.BaseKtCloudSignService;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.dto.AddPersonXbCertReqDTO;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.dto.AddPersonXbCertRespDTO;
import cn.maihe.elg.operation.supports.electronicseal.kt.cloudsign.enums.CloudSignInterfaceEnum;
import cn.maihe.elg.operation.utils.StringUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * @Description
 * @Author WJH
 * @Date 2022/09/07
 */
@Slf4j
@Service
public class AddPersonXbCertService extends BaseKtCloudSignService<AddPersonXbCertReqDTO, AddPersonXbCertRespDTO> {
    public AddPersonXbCertService(KtConfig ktConfig) {
        super(ktConfig);
    }

    @Override
    protected CloudSignInterfaceEnum serviceName() {
        return CloudSignInterfaceEnum.addPersonXbCert;
    }

    @Override
    public boolean successCode(String code) {
        /**
         * 当code为0000时说明操作成功，info中存放信息：
         * orderId：订单号
         * 当code为0008时说明订单记录已经存在，info中存放信息：
         * orderId：订单号
         *
         * 当code为0099时说明已经制作证书，info中存放信息：
         * orderId：订单号
         */
        return StringUtil.containsAny(code,"0000","0008","0099");
    }


}
